
#include "SpaceShooter.h"

void SpaceShooter::cleanup(){

	std::list<Object*>::iterator it;
	std::list<Animation>::iterator aIt;
	std::list<Texto*>::iterator tIt;

	if(dispSurface)
		SDL_FreeSurface(dispSurface);

	spaceBg.cleanup();

	for(it = objectList.begin(); it != objectList.end(); it++)
		delete ((Ship*) *it);

	objectList.clear();

	ship.cleanup();
	enemyShip_1.cleanup();
	enemyShip_2.cleanup();

	for(aIt = animationList.begin(); aIt != animationList.end(); aIt++)
		aIt->cleanup();

	animationList.clear();

	for(tIt = textList.begin(); tIt != textList.end(); tIt++)
		(*tIt)->onCleanup();

	textList.clear();

	TTF_Quit();
	SDL_Quit();
}

